home *** CD-ROM | disk | FTP | other *** search
-
- *** analyze.c Mon Sep 26 23:57:10 1988
- --- diff/analyze.c Tue Dec 06 10:38:50 1988
- ***************
- *** 116,119 ****
- --- 116,120 ----
- bmin > dmin ? bd[--bmin - 1] = INT_MAX : ++bmin;
- bmax < dmax ? bd[++bmax + 1] = INT_MAX : --bmax;
- +
- for (d = bmax; d >= bmin; d -= 2)
- {
- ***************
- *** 387,392 ****
- --- 388,401 ----
-
- /* Cancel provisional discards at the end, and shrink the run. */
- + #if defined(MSC_BUG)
- while (j > i && discards[j - 1] == 2)
- discards[j - 1] = 0, --provisional;
- + #else
- + {
- + int index = j - 1;
- + while (j > i && discards[index] == 2)
- + discards[index] = 0, --provisional;
- + }
- + #endif
-
- /* Now we have the length of a run of discardable lines
- ***************
- *** 652,658 ****
- --- 661,673 ----
- If so, we know they are identical without actually reading them. */
-
- + #if !defined(MSDOS)
- + /*
- + ** since MSC always sets the inode and dev fields to zero under DOS
- + ** this test will always think two files are the same.
- + */
- if (filevec[0].stat.st_ino == filevec[1].stat.st_ino
- && filevec[0].stat.st_dev == filevec[1].stat.st_dev)
- return 0;
- + #endif /* MSDOS */
-
- binary = read_files (filevec);
- ***************
- *** 664,670 ****
- --- 679,711 ----
- if (binary)
- {
- + #if !defined(MSDOS)
- int differs = (filevec[0].buffered_chars != filevec[1].buffered_chars
- || bcmp (filevec[0].buffer, filevec[1].buffer,
- filevec[1].buffered_chars));
- + #else
- + int differs;
- + if(filevec[0].buffered_chars != filevec[1].buffered_chars)
- + differs = 1;
- + else {
- + /*
- + ** we've got to do it in chunks because of our
- + ** poor 16 bit processor
- + */
- + char huge *b0 = filevec[0].buffer,
- + *b1 = filevec[1].buffer;
- + long int count;
- + unsigned int delta;
- + count = filevec[0].buffered_chars;
- + while(count > 0) {
- + delta = (unsigned)(count > 65000 ? 65000 : count);
- + if(bcmp(b0,b1,delta) != 0)
- + break;
- + count -= delta;
- + b0 += delta;
- + b1 += delta;
- + }
- + differs = count != 0;
- + }
- + #endif
- if (differs)
- message ("Binary files %s and %s differ\n",
- ***************
- *** 775,780 ****
- --- 816,826 ----
- for (i = 0; i < 2; ++i)
- {
- + #if !defined(MSDOS)
- if (filevec[i].buffer != 0)
- free (filevec[i].buffer);
- + #else /* MSDOS */
- + if (filevec[i].buffer != 0)
- + hfree (filevec[i].buffer);
- + #endif
- free (filevec[i].linbuf);
- }
- *** context.c Wed Sep 28 21:19:18 1988
- --- diff/context.c Mon Dec 05 10:36:40 1988
- ***************
- *** 253,257 ****
-
- /* If the change is ignorable, mark it. */
- ! script->ignore = (!deletes && !inserts);
-
- /* Advance to the following change. */
- --- 253,257 ----
-
- /* If the change is ignorable, mark it. */
- ! script->ignore = (char)(!deletes && !inserts);
-
- /* Advance to the following change. */
- *** diff.c Fri Oct 07 00:18:42 1988
- --- diff/diff.c Tue Dec 06 10:25:02 1988
- ***************
- *** 68,72 ****
- }
-
- ! main (argc, argv)
- int argc;
- char *argv[];
- --- 68,72 ----
- }
-
- ! void main (argc, argv)
- int argc;
- char *argv[];
- ***************
- *** 301,304 ****
- --- 301,305 ----
- }
-
- + void
- specify_style (style)
- enum output_style style;
- ***************
- *** 383,387 ****
- }
- }
- !
- /* See if the two named files are actually the same physical file.
- If so, we know they are identical without actually reading them. */
- --- 384,394 ----
- }
- }
- ! #if !defined(MSDOS)
- ! /*
- ! ** this stuff is real bad idea under MSDOS, at least for MSC 5.1
- ! ** because the st_ino and st_dev fields are not supported by
- ! ** MSDOS, and so stat sets them to zero; therefore
- ! ** this test always succeeds.
- ! */
- /* See if the two named files are actually the same physical file.
- If so, we know they are identical without actually reading them. */
- ***************
- *** 395,398 ****
- --- 402,406 ----
- goto done;
- }
- + #endif /* MSDOS */
-
- /* Open the files and record their descriptors. */
- ***************
- *** 411,415 ****
- {
- char *filename = inf[i].name;
- !
- inf[i].desc = open (filename, O_RDONLY, 0);
- if (0 > inf[i].desc)
- --- 419,431 ----
- {
- char *filename = inf[i].name;
- ! #if !defined(MSDOS)
- ! inf[i].desc = open (filename, O_RDONLY, 0);
- ! if (0 > inf[i].desc)
- ! {
- ! perror_with_name (filename);
- ! errorcount = 1;
- ! }
- ! #else
- ! if(inf[i].dir_p == 0) {
- inf[i].desc = open (filename, O_RDONLY, 0);
- if (0 > inf[i].desc)
- ***************
- *** 418,421 ****
- --- 434,440 ----
- errorcount = 1;
- }
- + } else
- + inf[i].desc = 0;
- + #endif /* MSDOS */
- }
- }
- *** diff.h Wed Oct 12 00:51:24 1988
- --- diff/diff.h Mon Dec 05 10:40:14 1988
- ***************
- *** 23,27 ****
- --- 23,31 ----
- #include <stdio.h>
- #include <sys/types.h>
- +
- + #if !defined(MSDOS)
- #include <sys/file.h>
- + #endif /* MSDOS */
- +
- #include <sys/stat.h>
-
- ***************
- *** 28,32 ****
- --- 32,40 ----
- #ifdef USG
- #include <time.h>
- +
- + #if !defined(MSDOS)
- #include <dirent.h>
- + #endif /* MSDOS */
- +
- #include <fcntl.h>
- #define direct dirent
- ***************
- *** 43,47 ****
- --- 51,57 ----
- #define bzero(s,n) memset((s),0,(n))
-
- + #if !defined(MSDOS)
- #define dup2(f,t) (close(t),fcntl((f),F_DUPFD,(t)))
- + #endif
-
- #define vfork fork
- ***************
- *** 50,57 ****
- --- 60,75 ----
- #endif
-
- + #ifdef MSDOS
- + #include <process.h>
- + #include <stdlib.h>
- + #endif /* MSDOS */
- +
- #include <errno.h>
- +
- + #if !defined(MSDOS)
- extern int errno;
- extern int sys_nerr;
- extern char *sys_errlist[];
- + #endif
-
- #define EOS (0)
- ***************
- *** 59,64 ****
- --- 77,84 ----
- #define TRUE 1
-
- + #if !defined(min)
- #define min(a,b) ((a) <= (b) ? (a) : (b))
- #define max(a,b) ((a) >= (b) ? (a) : (b))
- + #endif /* MSDOS */
-
- #ifndef PR_FILE_NAME
- ***************
- *** 68,73 ****
- --- 88,97 ----
- /* Support old-fashioned C compilers. */
- #if defined (__STDC__) || defined (__GNUC__)
- + #if !defined(MSDOS)
- #include "limits.h"
- #else
- + #include <limits.h>
- + #endif /* MSDOS */
- + #else
- #define INT_MAX 2147483647
- #define CHAR_BIT 8
- ***************
- *** 74,79 ****
- #endif
-
- /* Support old-fashioned C compilers. */
- ! #if !defined (__STDC__) && !defined (__GNUC__)
- #define const
- #endif
- --- 98,117 ----
- #endif
-
- + #if defined(MSDOS)
- + #ifdef INT_MAX
- + #undef INT_MAX
- + #include <limits.h>
- + #endif
- + #if !defined(MAKING_PROTO_H)
- + #include "proto.h"
- + #endif
- + #include <malloc.h>
- + #include <io.h>
- + #include <memory.h>
- + extern int getopt(int nargc,char **nargv,char *ostr);
- + #endif
- +
- /* Support old-fashioned C compilers. */
- ! #if !defined (__STDC__) && !defined (__GNUC__) || defined(MSDOS)
- #define const
- #endif
- ***************
- *** 215,223 ****
-
- /* Buffer in which text of file is read. */
- char * buffer;
- /* Allocated size of buffer. */
- int bufsize;
- /* Number of valid characters now in the buffer. */
- ! int buffered_chars;
-
- /* Array of data on analyzed lines of this chunk of this file. */
- --- 253,273 ----
-
- /* Buffer in which text of file is read. */
- + #if !defined(MSDOS)
- char * buffer;
- +
- /* Allocated size of buffer. */
- int bufsize;
- +
- + /* Number of valid characters now in the buffer. */
- + long int buffered_chars;
- + #else /* MSDOS */
- + char huge *buffer;
- +
- + /* Allocated size of buffer. */
- + long int bufsize;
- +
- /* Number of valid characters now in the buffer. */
- ! long int buffered_chars;
- ! #endif /* MSDOS */
-
- /* Array of data on analyzed lines of this chunk of this file. */
- ***************
- *** 315,316 ****
- --- 365,367 ----
- void message ();
- void print_message_queue ();
- +
- *** dir.c Tue Sep 20 13:32:58 1988
- --- diff/dir.c Tue Dec 06 11:34:58 1988
- ***************
- *** 32,35 ****
- --- 32,94 ----
- };
-
- + #if defined(MSDOS)
- + /*
- + ** due to difference of opinion btw gnu and microsoft about what
- + ** const means, const is defined away in diff.h, which causes warnings
- + ** when compiling the headers. This ugliness is avoided here.
- + */
- + #ifdef const
- + #undef const
- + #endif
- + #include <string.h>
- + #include <dos.h>
- +
- + struct direct {
- + char d_name[14];
- + };
- +
- + typedef struct _dir {
- + int first;
- + struct find_t dta;
- + struct direct current;
- + } DIR;
- +
- +
- + DIR *
- + opendir(char *name) {
- + char localname[65];
- + DIR *rval = malloc(sizeof(DIR));
- + strcpy(localname,name);
- + strcat(localname,"/*.*");
- + if(rval == NULL ||
- + _dos_findfirst(localname,_A_NORMAL|_A_SUBDIR,&rval->dta) != 0)
- + return NULL;
- + rval->first = 1;
- + return rval;
- + }
- +
- + void
- + closedir(DIR *x) {
- + free(x);
- + }
- +
- + struct direct *
- + readdir(DIR *thisdir) {
- + /*
- + ** first time through, we don't need to look for a file
- + */
- + if(!thisdir->first) {
- + if(_dos_findnext(&thisdir->dta) != 0)
- + return NULL;
- + } else
- + thisdir->first = 0;
- + strncpy(thisdir->current.d_name,thisdir->dta.name,13);
- + thisdir->current.d_name[13] = '\0';
- + strlwr(thisdir->current.d_name);
- + return &thisdir->current;
- + }
- +
- + #endif /* MSDOS */
- +
- static struct dirdata
- dir_sort (dirname)
- ***************
- *** 55,59 ****
- {
- pfatal_with_name (dirname);
- ! return;
- }
-
- --- 114,118 ----
- {
- pfatal_with_name (dirname);
- ! return dirdata;
- }
-
- ***************
- *** 124,128 ****
- --- 183,195 ----
- diff_dirs (name1, name2, handle_file, depth)
- char *name1, *name2;
- + #if !defined(MSDOS)
- int (*handle_file) ();
- + #else
- + /* sorry, rms, I can't live with the assumption that
- + ** sizeof(char *) == sizeof(int)
- + */
- + int (*handle_file)(char *dir0,char *name0,
- + char *dir1,char *name1,int depth);
- + #endif
- {
- struct dirdata data1, data2;
- ***************
- *** 176,180 ****
- {
- /* Next filename in dir 1 is less; that is a file in dir 1 only. */
- ! v1 = handle_file (name1, data1.files[i1], name2, 0, depth + 1);
- i1++;
- }
- --- 243,248 ----
- {
- /* Next filename in dir 1 is less; that is a file in dir 1 only. */
- ! v1 = handle_file (name1, data1.files[i1], name2, (char *)0,
- ! depth + 1);
- i1++;
- }
- ***************
- *** 182,186 ****
- {
- /* Next filename in dir 2 is less; that is a file in dir 2 only. */
- ! v1 = handle_file (name1, 0, name2, data2.files[i2], depth + 1);
- i2++;
- }
- --- 250,255 ----
- {
- /* Next filename in dir 2 is less; that is a file in dir 2 only. */
- ! v1 = handle_file (name1, (char *)0, name2, data2.files[i2],
- ! depth + 1);
- i2++;
- }
- *** io.c Mon Sep 26 22:27:28 1988
- --- diff/io.c Tue Dec 06 11:19:24 1988
- ***************
- *** 22,27 ****
- --- 22,31 ----
-
- /* Rotate a value n bits to the left. */
- + #if !defined(MSDOS)
- #define UINT_BIT (sizeof (unsigned) * CHAR_BIT)
- #define ROL(v, n) ((v) << (n) | (v) >> UINT_BIT - (n))
- + #else
- + #define ROL(v,n) ((v) << (n) | (v) >> (sizeof(v) * CHAR_BIT) - (n))
- + #endif
-
- /* Given a hash value and a new character, return a new hash value. */
- ***************
- *** 62,65 ****
- --- 66,70 ----
- current->buffer = 0;
- }
- + #if !defined(MSDOS)
- /* If it's a regular file, we can just get the size out of the stat
- block and slurp it in all at once. */
- ***************
- *** 70,76 ****
- --- 75,97 ----
- current->buffered_chars
- = read (current->desc, current->buffer, current->bufsize);
- + #else /* MSDOS */
- + else {
- + current->bufsize = current->stat.st_size + 1;
- + if((current->buffer =
- + (char huge *)halloc(current->bufsize,sizeof(char))) == NULL)
- + fatal("virtual memory exhausted");
- + {
- + int count;
- + current->buffered_chars = 0;
- + while((count = read(current->desc,
- + current->buffer+current->buffered_chars,
- + 32000)) > 0)
- + current->buffered_chars += count;
- + }
- + #endif /* MSDOS */
- if (current->buffered_chars < 0)
- pfatal_with_name (current->name);
- }
- + #if !defined(MSDOS)
- else
- {
- ***************
- *** 97,100 ****
- --- 118,122 ----
- pfatal_with_name (current->name);
- }
- + #endif /* MSDOS */
-
- /* Check first part of file to see if it's a binary file. */
- ***************
- *** 129,135 ****
- --- 151,167 ----
-
- /* Attempt to get a good initial guess as to the number of lines. */
- + #if !defined(MSDOS)
- current->linbufsize = current->buffered_chars / 50 + 5;
- current->linbuf
- = (struct line_def *) xmalloc (current->linbufsize * sizeof (struct line_def));
- + #else
- + long int buffersize;
- + current->linbufsize = (int)
- + (buffersize = (long int)(current->buffered_chars / 50 + 5));
- + buffersize *= sizeof(struct line_def);
- + if(buffersize > 65535L)
- + fatal("Too many lines to compare");
- + current->linbuf = (struct line_def *) xmalloc((size_t)buffersize);
- + #endif
-
- if (function_regexp)
- ***************
- *** 291,296 ****
- int lines;
- /* Number of bytes left to scan. */
- int bytes = min (filevec[0].buffered_chars, filevec[1].buffered_chars);
- !
- /* Find identical prefix. */
-
- --- 323,331 ----
- int lines;
- /* Number of bytes left to scan. */
- + #if !defined(MSDOS)
- int bytes = min (filevec[0].buffered_chars, filevec[1].buffered_chars);
- ! #else
- ! long int bytes = min (filevec[0].buffered_chars, filevec[1].buffered_chars);
- ! #endif
- /* Find identical prefix. */
-
- ***************
- *** 388,391 ****
- --- 423,427 ----
- 32749,
- 65521,
- + #if !defined MSDOS
- 131071,
- 262139,
- ***************
- *** 399,402 ****
- --- 435,439 ----
- 67108859, /* Preposterously large . . . */
- -1
- + #endif
- };
-
- ***************
- *** 410,414 ****
- int n;
- {
- ! int bucket = current->linbuf[n].hash % nbuckets;
- struct equivclass *b = buckets[bucket], *p = NULL;
-
- --- 447,451 ----
- int n;
- {
- ! int bucket = (int)(current->linbuf[n].hash % nbuckets);
- struct equivclass *b = buckets[bucket], *p = NULL;
-
- *** regex.c Sat Oct 08 01:16:56 1988
- --- diff/regex.c Thu Dec 08 08:20:48 1988
- ***************
- *** 136,139 ****
- --- 136,145 ----
- #endif
-
- + #ifdef MSDOS
- + #include <memory.h>
- + #include <malloc.h>
- + #include "diff.h"
- + #endif
- +
- /*
- * Define the syntax stuff, so we can do the \<...\> things.
- ***************
- *** 188,192 ****
- #ifndef NFAILURES
- #define NFAILURES 80
- ! #endif NFAILURES
-
- /* width of a byte in bits */
- --- 194,198 ----
- #ifndef NFAILURES
- #define NFAILURES 80
- ! #endif /* NFAILURES */
-
- /* width of a byte in bits */
- ***************
- *** 246,249 ****
- --- 252,256 ----
- #define PATUNFETCH p--
-
- + #if !defined(MSDOS)
- #define EXTEND_BUFFER \
- { char *old_buffer = bufp->buffer; \
- ***************
- *** 263,268 ****
- pending_exact += c; \
- }
- !
- ! static int store_jump (), insert_jump ();
-
- char *
- --- 270,293 ----
- pending_exact += c; \
- }
- ! #else
- ! #define EXTEND_BUFFER \
- ! { char *old_buffer = bufp->buffer; \
- ! if (bufp->allocated == (1<<15)) goto too_big; \
- ! bufp->allocated *= 2; \
- ! if (bufp->allocated > (1<<15)) bufp->allocated = (1<<15); \
- ! if (!(bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated))) \
- ! goto memory_exhausted; \
- ! c = bufp->buffer - old_buffer; \
- ! b += c; \
- ! if (fixup_jump) \
- ! fixup_jump += c; \
- ! if (laststart) \
- ! laststart += c; \
- ! begalt += c; \
- ! if (pending_exact) \
- ! pending_exact += c; \
- ! }
- ! #endif
- ! static void store_jump (), insert_jump ();
-
- char *
- ***************
- *** 345,350 ****
- --- 370,379 ----
- else
- /* Caller did not allocate a buffer. Do it for him */
- + #if !defined(MSDOS)
- bufp->buffer = (char *) malloc (28);
- if (!bufp->buffer) goto memory_exhausted;
- + #else
- + bufp->buffer = (char *) xmalloc(28);
- + #endif
- begalt = b = bufp->buffer;
- }
- ***************
- *** 746,750 ****
- `opcode' is the opcode to store. */
-
- ! static int
- store_jump (from, opcode, to)
- char *from, *to;
- --- 775,779 ----
- `opcode' is the opcode to store. */
-
- ! static void
- store_jump (from, opcode, to)
- char *from, *to;
- ***************
- *** 752,757 ****
- {
- from[0] = opcode;
- ! from[1] = (to - (from + 3)) & 0377;
- ! from[2] = (to - (from + 3)) >> 8;
- }
-
- --- 781,786 ----
- {
- from[0] = opcode;
- ! from[1] = (char)((to - (from + 3)) & 0377);
- ! from[2] = (char)((to - (from + 3)) >> 8);
- }
-
- ***************
- *** 763,767 ****
- If you call this function, you must zero out pending_exact. */
-
- ! static int
- insert_jump (op, from, to, current_end)
- char op;
- --- 792,796 ----
- If you call this function, you must zero out pending_exact. */
-
- ! static void
- insert_jump (op, from, to, current_end)
- char op;
- ***************
- *** 1274,1278 ****
- case start_memory:
- regstart[*p] = d;
- ! regstart_seg1[*p++] = (dend == end_match_1);
- break;
-
- --- 1303,1307 ----
- case start_memory:
- regstart[*p] = d;
- ! regstart_seg1[*p++] = (unsigned char)(dend == end_match_1);
- break;
-
- ***************
- *** 1279,1283 ****
- case stop_memory:
- regend[*p] = d;
- ! regend_seg1[*p++] = (dend == end_match_1);
- break;
-
- --- 1308,1312 ----
- case stop_memory:
- regend[*p] = d;
- ! regend_seg1[*p++] = (unsigned char)(dend == end_match_1);
- break;
-
- ***************
- *** 1424,1428 ****
- /* p1[0] ... p1[2] are an on_failure_jump.
- Examine what follows that */
- ! if (p1[3] == (unsigned char) exactn && p1[5] != c)
- p[-3] = (unsigned char) finalize_jump;
- else if (p1[3] == (unsigned char) charset
- --- 1453,1457 ----
- /* p1[0] ... p1[2] are an on_failure_jump.
- Examine what follows that */
- ! if (p1[3] == (char) exactn && p1[5] != (char)c)
- p[-3] = (unsigned char) finalize_jump;
- else if (p1[3] == (unsigned char) charset
- ***************
- *** 1661,1669 ****
- if (!re_comp_buf.buffer)
- {
- if (!(re_comp_buf.buffer = (char *) malloc (200)))
- return "Memory exhausted";
- - re_comp_buf.allocated = 200;
- if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
- return "Memory exhausted";
- }
- return re_compile_pattern (s, strlen (s), &re_comp_buf);
- --- 1690,1703 ----
- if (!re_comp_buf.buffer)
- {
- + #if !defined(MSDOS)
- if (!(re_comp_buf.buffer = (char *) malloc (200)))
- return "Memory exhausted";
- if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
- return "Memory exhausted";
- + #else
- + re_comp_buf.buffer = (char *) xmalloc(200);
- + re_comp_buf.fastmap = (char *) xmalloc(1 << BYTEWIDTH);
- + #endif
- + re_comp_buf.allocated = 200;
- }
- return re_compile_pattern (s, strlen (s), &re_comp_buf);
- *** util.c Fri Sep 30 11:04:10 1988
- --- diff/util.c Mon Dec 05 10:36:40 1988
- ***************
- *** 131,134 ****
- --- 131,135 ----
- strcat (name, name1);
-
- + #if !defined(MSDOS)
- if (paginate_flag)
- {
- ***************
- *** 163,166 ****
- --- 164,168 ----
- }
- else
- + #endif
- {
-
- ***************
- *** 187,191 ****
- --- 189,195 ----
- {
- fclose (outfile);
- + #if !defined(MSDOS)
- wait (0);
- + #endif
- }
- }
- ***************
- *** 222,226 ****
-
- /* Undo the alteration. */
- ! s1->text[s1->length] = savechar;
-
- /* If the comparison stopped at the alteration,
- --- 226,230 ----
-
- /* Undo the alteration. */
- ! s1->text[s1->length] = (char) savechar;
-
- /* If the comparison stopped at the alteration,
- ***************
- *** 617,620 ****
- --- 621,625 ----
- }
-
- + void
- debug_script (sp)
- struct change *sp;
-